using System;
using System.Linq.Expressions;

namespace JGSY.CMS.LowCode.Platform.Domain.Interfaces
{
    /// <summary>
    /// 规范模式接口
    /// 用于封装复杂的查询条件
    /// </summary>
    /// <typeparam name="T">实体类型</typeparam>
    public interface ISpecification<T>
    {
        /// <summary>
        /// 查询条件表达式
        /// </summary>
        Expression<Func<T, bool>> Criteria { get; }

        /// <summary>
        /// Include表达式列表
        /// </summary>
        System.Collections.Generic.List<Expression<Func<T, object>>> Includes { get; }

        /// <summary>
        /// Include字符串列表
        /// </summary>
        System.Collections.Generic.List<string> IncludeStrings { get; }

        /// <summary>
        /// 排序表达式
        /// </summary>
        Expression<Func<T, object>>? OrderBy { get; }

        /// <summary>
        /// 降序排序表达式
        /// </summary>
        Expression<Func<T, object>>? OrderByDescending { get; }

        /// <summary>
        /// 分组表达式
        /// </summary>
        Expression<Func<T, object>>? GroupBy { get; }

        /// <summary>
        /// 是否启用分页
        /// </summary>
        bool IsPagingEnabled { get; }

        /// <summary>
        /// 跳过记录数
        /// </summary>
        int Take { get; }

        /// <summary>
        /// 获取记录数
        /// </summary>
        int Skip { get; }

        /// <summary>
        /// 是否启用缓存
        /// </summary>
        bool IsCacheEnabled { get; }

        /// <summary>
        /// 缓存键
        /// </summary>
        string? CacheKey { get; }

        /// <summary>
        /// 缓存过期时间
        /// </summary>
        TimeSpan? CacheExpiration { get; }
    }
}
